-
Notifications
You must be signed in to change notification settings - Fork 892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
generate Embedded ObjectMeta in the CRDs #4315
Conversation
Verification report
➜ karmada git:(master) ✗ kubectl apply -f operator/config/crds/operator.karmada.io_karmadas.yaml
customresourcedefinition.apiextensions.k8s.io/karmadas.operator.karmada.io configured
➜ karmada git:(master) ✗ kubectl apply -f operator/config/samples/karmada.yaml
karmada.operator.karmada.io/karmada-demo configured |
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #4315 +/- ##
==========================================
- Coverage 51.99% 51.89% -0.11%
==========================================
Files 242 243 +1
Lines 23977 24150 +173
==========================================
+ Hits 12468 12532 +64
- Misses 10829 10935 +106
- Partials 680 683 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
/assign |
Can you help test the situation where both |
Do you mean |
I tested it according to your request and the results are as follows.
➜ karmada git:(master) ✗ kubectl apply -f operator/config/samples/karmada.yaml
The Karmada "karmada-demo" is invalid:
* spec.components.etcd.local.volumeData.volumeClaim.metadata.namespace: Invalid value: "integer": spec.components.etcd.local.volumeData.volumeClaim.metadata.namespace in body must be of type string: "integer"
* spec.components.etcd.local.volumeData.volumeClaim.metadata.name: Invalid value: "integer": spec.components.etcd.local.volumeData.volumeClaim.metadata.name in body must be of type string: "integer"
➜ karmada git:(master) ✗ kubectl apply -f operator/config/samples/karmada.yaml
karmada.operator.karmada.io/karmada-demo created |
This is exactly the issue I encountered. It seems that your PR did not solve this issue, right? |
Do you mean that you want to set name or namespace a int value? |
@chaunceyjiang Hi~ referring to your issue #4332, what you expect is to set the namespace and name to "123", if so, this PR solves the problem, you can refer to #4315 (comment) for the second scenario. |
Signed-off-by: zhzhuang-zju <m17799853869@163.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
The root cause is that controller-gen
skips embedded metada
when generating CRDs.
generateEmbeddedObjectMetabool
specifies if any embedded ObjectMeta in the CRD should be generated
PS:
VolumeClaim *corev1.PersistentVolumeClaimTemplate `json:"volumeClaim,omitempty"` |
The corev1.PersistentVolumeClaimTemplate
includes metadata definition.
@chaunceyjiang Would you like to take another look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks~
/lgtm
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: RainbowMango The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind bug
What this PR does / why we need it:
generate Embedded ObjectMeta in the CRDs
Which issue(s) this PR fixes:
Fixes #4128
Special notes for your reviewer:
none
Does this PR introduce a user-facing change?: